﻿using Learun.Util;
using SqlSugar;
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Learun.Application.Message
{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2019-09-10 10:12
    /// 描 述：消息记录管理
    /// </summary>
    public class MES_MSG_RecordEntity 
    {
        #region 实体成员
        /// <summary>
        /// 主键
        /// </summary>
        [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)]
        public string ID { get; set; }
        /// <summary>
        /// 标题
        /// </summary>
        [SugarColumn(ColumnName = "TITLE")]
        public string Title { get; set; }
        /// <summary>
        /// 内容
        /// </summary>
        [SugarColumn(ColumnName = "CONTENT")]
        public string Content { get; set; }
        /// <summary>
        /// 发送人
        /// </summary>
        [SugarColumn(ColumnName = "SENDER")]
        public string Sender { get; set; }
        /// <summary>
        /// 接收人
        /// </summary>
        [SugarColumn(ColumnName = "RECEIVER")]
        public string Receiver { get; set; }
        /// <summary>
        /// 消息类型，1：邮件；2：微信；3：短信；4：系统IM
        /// </summary>
        [SugarColumn(ColumnName = "MSGTYPE")]
        public string MsgType { get; set; }
        /// <summary>
        /// 发送状态，1：成功；2：失败
        /// </summary>
        [SugarColumn(ColumnName = "STATUS")]
        public string Status { get; set; }
        /// <summary>
        /// 发送次数，超过3次不再发送
        /// </summary>
        [SugarColumn(ColumnName = "SENDCNT")]
        public int? SendCnt { get; set; }
        /// <summary>
        /// 发送时间
        /// </summary>
        [SugarColumn(ColumnName = "SENDTIME")]
        public DateTime? SendTime { get; set; }
        /// <summary>
        /// 接收人账号
        /// </summary>
        [SugarColumn(ColumnName = "ACCOUNTER")]
        public string Accounter { get; set; }
        /// <summary>
        /// 邮件地址
        /// </summary>
        [SugarColumn(ColumnName = "MAILADDRESS")]
        public string MailAddress { get; set; }
        /// <summary>
        /// 接收手机
        /// </summary>
        [SugarColumn(ColumnName = "PHONE")]
        public string Phone { get; set; }
        /// <summary>
        /// 错误内容
        /// </summary>
        [SugarColumn(ColumnName = "ERRCONTENT")]
        public string ErrContent { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CREATETIME")]
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        [SugarColumn(ColumnName = "CREATEMAN")]
        public string CreateMan { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.ID = Guid.NewGuid().ToString();
            this.CreateTime = DateTime.Now;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateMan = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.ID = keyValue;
        }
        #endregion
        #region 扩展字段
        #endregion
    }
}

